/*
 * @lc app=leetcode.cn id=190 lang=cpp
 *
 * [190] 颠倒二进制位
 */
#include "include.h"
// @lc code=start
class Solution {
public:
    uint32_t reverseBits(uint32_t n) {
        uint32_t res = 0;
        uint32_t one = 1;
        for (int i=0;i<32;++i){
            // bit &
            uint32_t lastBit = n & one;
            n >>= 1;
            res <<= 1;
            res += lastBit;
        }
        return res;
    }
};
// @lc code=end

